package org.apache.servicecomb.samples.practise.houserush.sale.api;

import org.apache.servicecomb.samples.practise.houserush.sale.aggregate.Favorite;
import org.apache.servicecomb.samples.practise.houserush.sale.aggregate.HouseOrder;
import org.apache.servicecomb.samples.practise.houserush.sale.aggregate.Sale;
import org.apache.servicecomb.samples.practise.houserush.sale.aggregate.SaleQualification;

import java.util.List;

/**
 * @Author: Snake Man
 * @system:
 * @DateTime: 2022/1/18 13:28
 * @Description:
 */
public interface HouseOrderApi {

    //GET 查询所有活动，包括楼盘名称 sales
    List<Sale> indexSales();

    //GET 查询所有活动，包括楼盘名称 sales/indexAllSales
    List<Sale> indexAllSales();

    //GET 根据活动id查询活动，包括楼盘名称 sales/{saleId}
    Sale findSale(int saleId);

    //GET 根据楼盘查询活动 sales/realestate/{realestateId}
    List<Sale> findSaleByRealestateId(int realestateId);

    //创建活动
    Sale createSale(Sale sale);

    //PUT 根据id修改活动 sales/{saleId}
    Sale updateSale(int saleId, Sale sale);

    //DELETE 根据id删除活动 sales/{saleId}
    void removeSale( int saleId);

    //GET 根据id查询开售活动，给前台客户抢房系统使用的接口 sales/order/{saleId}
    Sale findOrderSale(int saleId);

    //PUT 同步修改活动资格 sale_qualification
    void updateSaleQualification(List<SaleQualification> saleQualifications);

    //DELETE 同步删除活动资格 sales/removeSaleQualification
    void removeSaleQualification(int customerId);

    //GET 查询活动房源数量 sales/countBySaleId/{saleId}
    int countHouseBySaleId(int saleId);

    //GET 根据客户id查询收藏 /favorites
    List<Favorite> findMyFavorite(int customerId);

    //PUT 客户收藏房源 /house_orders/{houseOrderId}/add_favorite
    Favorite addFavorite(int customerId, int houseOrderId);

    //DELETE 根据id删除收藏 /favorites/{id}
    void removeFavorite(int customerId, int id);

    //GET 根据房源订单id查询房源订单 /house_orders/{houseOrderId}
    HouseOrder findOne(int houseOrderId);

    //GET 根据房源id查询房源订单 /sales/findAllByHouseId/{houseId}
    HouseOrder findAllByHouseId(Integer houseId);

    //GET 根据客户id查询该客户的所有房源订单 /sales/findAllByCustomerId
    List<HouseOrder> findAllByCustomerId(int cucustomerId);

    //GET 前台首页活动查询 sales/list
    List<Sale> indexListSales(int customerId);

    //GET 前台抢购活动详情 sales/details/{saleId}
    List<Sale> indexDetailsSales(int customerId, int saleId);


    //GET 后台活动订单查询 sales/indexOrderSales
    List<Sale> indexOrderSales();

    //GET 活动资格查询 sales/findBySaleIdAndCustomerId/{saleId}
    SaleQualification findBySaleIdAndCustomerId(int saleId, int customerId);

    //PUT 抢购房源 /house_orders/{saleId}/{houseOrderId}/{orderId}
    HouseOrder placeHouseOrder(int customerId, int saleId, int houseOrderId,int orderId);

    //PUT 取消房源订单 /house_orders/{houseOrderId}/cancel/{orderId}
    HouseOrder cancelHouseOrder(int customerId, int houseOrderId, int orderId);

}
